import request from '@/utils/request'
import qs from 'qs'

export function getSpuImage(spuIdList) {
  return request({
    url: `/api/coupon/coupon/getSpuImage`,
    method: 'post',
    data: spuIdList
  })
}

export function getCategoryImage(categoryIdList) {
  return request({
    url: `/api/coupon/coupon/getCategoryImage`,
    method: 'post',
    data: categoryIdList
  })
}

export function getUseTypeList(id, useType) {
  return request({
    url: `/api/coupon/coupon/getUseTypeList`,
    method: 'get',
    params: {id: id, useType: useType}
  })
}

export function publishCoupon(couponId) {
  return request({
    url: `/api/coupon/coupon/publish/${couponId}`,
    method: 'get',
    param: couponId
  })
}

export function list(query) {
  return request({
    url: `/api/coupon/coupon/list`,
    method: 'post',
    data: query
  })
}

export function info(id) {
  return request({
    url: `/api/coupon/coupon/info/${id}`,
    method: 'get',
    param: id
  })
}

export function add(query) {
  return request({
    url: '/api/coupon/coupon/save',
    method: 'post',
    data: query
  })
}

export function delMultiple(ids) {
  return request({
    url: '/api/coupon/coupon/delete',
    method: 'post',
    data: ids
  })
}

export function update(query) {
  return request({
    url: '/api/coupon/coupon/update',
    method: 'post',
    data: query
  })
}
